package com.good.adminController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.good.aop.GoalA;
import com.good.entity.Admin;
import com.good.service.AdminService;

@Controller
public class TestController {
	@Resource(name = "adminServiceImpl")
	private AdminService adminService;
	@Resource(name="goalA")
	private GoalA goalA;
	
	@RequestMapping(value="/cache")
	public String cache(Model model) {
		Admin admin = adminService.getByAccount("account");
		model.addAttribute("admin", admin);
		return "/cache";
	}
	@RequestMapping(value="/urlDemo")
	public String urlDemo(HttpServletRequest req){
	String url=	req.getScheme();
	url+=req.getHeader("host");
	url+=req.getRequestURI();
	if(req.getQueryString()!=null){
		url+="?"+req.getQueryString();
	}
	System.out.println(url);
		return "index";
	}
	
	@RequestMapping(value="goalA")
	public void goalA(){
		goalA.fooA("abcd");
		System.out.println("goalA");
	}
}
